<%@ page language="java" import="java.util.*"  pageEncoding="utf-8"%>
<%@include file="common/tag.jsp"%>
<c:set var="CTX" value="${pageContext.request.contextPath}" />
<%@include file="common/indexhead.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
    
    <title>客户供应商新增页</title>
    </head>
  <style>
  .panel .panel-heading button {
  	padding: ;
	margin-left: ;
	background-color: ;
	border: ;
	outline: ;
  }
  </style>
 <body>
<div class="panel panel-primary">
	<div class="panel-heading">
		<div>
			<h3 class="panel-title">客户供应商新增页</h3>
		</div>
		<div class="button"
			style="float: right;margin-top: -27px;margin-right: 5px;">
			<a class="btn btn-info" href="#" onclick="javascript:window.close();"><i class="fa fa-sign-out"></i>退出</a>
		</div>
		<div class="button"
			style="float: right;margin-top: -27px;margin-right: 5px;">
			<div class="btn btn-info"   onclick="tijiao()" href=""><i class="fa fa-check"></i>保存</div>
		</div>
	</div>
	<div class="panel-body" style="height:87%">

		<!-- <form modelAttribute="User"    id="userdetail" action="/user/update" method="POST" class="form-horizontal" -->
			<form   id="userdetail"  class="form-horizontal"
			style="width:90%;margin-top: 50px;">
			<fieldset>
				<div class="form-group">
					<label class="col-sm-2 control-label">单位编码</label>
					<div class="col-sm-4">
						<input readOnly=true class="form-control" id="businessNumber" name="businessNumber" type="text"
						placeholder = "${number}" value = "${number}"/>
					</div>
					<label class="col-sm-2 control-label">单位名称</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessDwmc" name="businessDwmc" type="text"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">单位简称</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessDwjc" name="businessDwjc" type="text"/>
					</div>
					<label class="col-sm-2 control-label">单位性质</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessDwxz" name="businessDwxz" type="text"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">开户银行</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessKhyh" name="businessKhyh" type="text"/>
					</div>
					<label class="col-sm-2 control-label" for="ds_name">银行账号</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessYhzh" name="businessYhzh" type="text"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">税号</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessSh" name="businessSh" type="text"/>
					</div>
					<label class="col-sm-2 control-label">备注</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessBz" name="businessBz" type="text"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">联系人</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessLxr" name="businessLxr" type="text"/>
					</div>
					<label class="col-sm-2 control-label">联系电话</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessDh" name="businessDh" type="text"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">职务</label>
					<div class="col-sm-4">
						<input class="form-control" id="businessZw" name="businessZw" type="text"/>
					</div>
					<label class="col-sm-2 control-label">传真</label>
					<div class="col-sm-4">
						<input  class="form-control" id="businessCz" name="businessCz" type="text""/>
					</div>
				</div>
			</fieldset>
		</form>
		<hr></hr>
	</div>
</div>
<!-- 弹出框重写 -->
<div id="ycf-alert" class="modal">
      <div class="modal-dialog modal-sm">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
            <h5 class="modal-title"><i class="fa fa-exclamation-circle"></i> [Title]</h5>
          </div>
          <div class="modal-body small">
            <p>[Message]</p>
          </div>
          <div class="modal-footer" >
            <button type="button" class="btn btn-primary ok" data-dismiss="modal">[BtnOk]</button>
            <button type="button" class="btn btn-default cancel" data-dismiss="modal">[BtnCancel]</button>
          </div>
        </div>
      </div>
    </div>
<!-- 弹出框重写end -->
<%@include file="common/indexbottom.jsp"%>
<script type="text/javascript">
$(function() {
window.Modal = function() {
    var reg = new RegExp("\\[([^\\[\\]]*?)\\]", 'igm');
    var alr = $("#ycf-alert");
    var ahtml = alr.html();
    
    var _alert = function(options) {
        alr.html(ahtml); // 复原
        alr.find('.ok').removeClass('btn-success').addClass('btn-primary');
        alr.find('.cancel').hide();
        _dialog(options);

        return {
            on: function(callback) {
                if (callback && callback instanceof Function) {
                    alr.find('.ok').click(function() {
                        callback(true)
                    });
                }
            }
        };
    };

    var _confirm = function(options) {
        alr.html(ahtml); // 复原
        alr.find('.ok').removeClass('btn-primary').addClass('btn-success');
        alr.find('.cancel').show();
        _dialog(options);

        return {
            on: function(callback) {
                if (callback && callback instanceof Function) {
                    alr.find('.ok').click(function() {
                        callback(true)
                    });

                }
            }
        };
    };

    var _dialog = function(options) {
        var ops = {
            msg: "提示内容",
            title: "操作提示",
            btnok: "确定",
            btncl: "取消"
        };

        $.extend(ops, options);

        console.log(alr);

        var html = alr.html().replace(reg,
        function(node, key) {
            return {
                Title: ops.title,
                Message: ops.msg,
                BtnOk: ops.btnok,
                BtnCancel: ops.btncl
            } [key];
        });

        alr.html(html);
        alr.modal({
            width: 500,
            backdrop: 'static'
        });
    }

    return {
        alert: _alert,
        confirm: _confirm
    }

} ();
});

function tijiao() {
var businessDwxz = $("#businessDwxz").val();
Modal.confirm({
    msg: "是否新增"+businessDwxz+"？"
}).on(function(e) {
    var businessNumber = $("#businessNumber").val();
    var businessDwmc = $("#businessDwmc").val();
    var businessDwjc = $("#businessDwjc").val();
    var businessKhyh = $("#businessKhyh").val();
    var businessYhzh = $("#businessYhzh").val();
    var businessSh = $("#businessSh").val();
    var businessBz = $("#businessBz").val();
    var businessLxr = $("#businessLxr").val();
    var businessDh = $("#businessDh").val();
    var businessZw = $("#businessZw").val();
    var businessCz = $("#businessCz").val();
    $.ajax({
        type: "post",
        url: yongan.URL.businessAdd(),
        dataType: "json",
        data: {
            businessDwxz: businessDwxz,
            businessNumber: businessNumber,
            businessDwmc: businessDwmc,
            businessDwjc: businessDwjc,
            businessKhyh: businessKhyh,
            businessYhzh: businessYhzh,
            businessSh: businessSh,
            businessBz: businessBz,
            businessLxr: businessLxr,
            businessDh : businessDh,
            businessCz : businessCz,
            businessZw : businessZw
        },
        success: function(data) {

            if (data['success']) {
                Modal.alert({
                    msg: data['data']['stateinfo'],
                    title: '执行结果',
                    btnok: '确定',
                    btncl: '取消'
                }).on(function(e) {
                    window.close();
                });
            }
        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
            alert(XMLHttpRequest);
            alert(textStatus);
            alert(errorThrown);
        }
    });
});
}
</script>
  </body>
</html>